<template>
  <el-upload
    ref="eluploadimg"
    :action="FileUrl"
    :multiple="isMultiple"
    :data="Data"
    list-type="picture-card"
    :auto-upload="false"
    :headers="httpHeaders"
    :on-remove="handleRemove"
    :file-list="picList"
    :on-change="handleChange"
    :on-success="handleSuccess"
    :on-progress="handleProgress"
  >
    <i class="el-icon-plus"></i>
    <div class="el-upload__tip" slot="tip">
      <p>只能上传jpg/png文件</p>
    </div>
  </el-upload>
</template>

<script>
import { getToken } from "@/utils/auth";
export default {
  name: "ImageUpload",
  props: {
    picList: {
      type: Array,
      default: function() {
        return [];
      }
    },
    Data: {
      type: Object
    },

    FileUrl: {
      type: String
    },
    handleSuccess: {
      type: Function
    },
    handleChange: {
      type: Function
    },
    handleProgress: {
      type: Function
    },
    isMultiple: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      httpHeaders: {
        Authorization: getToken()
      },
      dialogImageUrl: "",
      dialogVisible: false
    };
  },
  methods: {
    handleRemove(file, fileList) {},
    // 上传图片
    UploadSubmit() {
      this.$refs.eluploadimg.submit();
    }
  }
};
</script>


